﻿using System.Windows;
using GameEngine.Clients.Silverlight;
using GameEngine.Model;
using GameEngine.Model.Data;
using MySettlers.View.Components;
using System;

namespace MySettlers.Things
{
    public class BuildingVO : ThingVO<int>
    {
        //percentagebuilded
        public BuildingVO(IThingVOId<int> id, IThingTypeVOId typeId):
             base(id, typeId)
        {
            //ClassType = "BuildingVO";
        }

        public BuildingVO()
        {
            //ClassType = "BuildingVO";
        }
    }

    public class BuildingDataProxy : ThingDataProxy<int>
    {
        //percentagebuilded
        public new BuildingVO VO
        {
            get { return this.Data as BuildingVO; }
        }

        public BuildingDataProxy(
            BuildingVO item
            )
            : base(item)
        {

        }

        //protected bool producedPeasant = false;
        public static void Action(EngineDataProxy<int> engine, IWorldDataProxy<int> world, IThingTypeDataProxy<int> itemType, IThingDataProxy<int> item)
        {

            BuildingDataProxy thing = (BuildingDataProxy)item;
            BuildingTypeDataProxy thingType = (BuildingTypeDataProxy)itemType;

            //if (!thing.producedPeasant)
            //{
            //    SilverlightViewFacade.Helper.AddThingToWorld(
            //        new PeasantVO(new ThingVOId<int>(SilverlightModelFacade.Instance.CreateNewId(),"peasant"), MyFacade.Instance.peasantMaleTypeId)
            //        {
            //            Position = new MapEngine.Point3d(new Point(thing.Position.X+2, thing.Position.Y), 0),
            //        }, MyFacade.Instance.currentWorldId
            //        );

            //    thing.producedPeasant = true;
            //}
        }
    }

    public class BuildingTypeVO : ThingTypeVO<int>
    {
        public BuildingTypeVO(IThingTypeVOId id) :
            base(id)
        {
            //Type = "BuildingTypeVO";
        }
        public BuildingTypeVO() { }
    }

    public class BuildingTypeDataProxy : ThingTypeDataProxy<int>
    {
        public BuildingTypeDataProxy(
            IThingTypeVO<int> typeVO,
            IViewDataProxy<int> view)
            : base(typeVO, view)
        {
            
        }
    }
}
